package com.xinsoft.controller.basic;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xinsoft.aop.ano.SysLog;
import com.xinsoft.common.BusinessType;
import com.xinsoft.common.Response;
import com.xinsoft.entity.dto.SysReportConfigParam;
import com.xinsoft.entity.po.SysReportConfig;
import com.xinsoft.service.*;
import com.xinsoft.validator.ValidatorUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * @ClassName SysReportConfigController
 * @Description 首页控制层
 * @Author lijie
 * @Date 2023-11-23 09:05:46
 * @Version 1.0
 */
@RestController
@RequestMapping("/system/home")
@Api(value = "SysHomePageController", tags = {"首页控制层"})
public class SysHomePageController {
	@Autowired
	private SysReportConfigService configService;

	@Autowired
	private CusDeviceService deviceService;

	@Autowired
	private MesProducePlanService mesProducePlanService;

	@Autowired
	private ScmPurchasePlanService scmPurchasePlanService;

	@Autowired
	private QuaMaterialInspectionService quaMaterialInspectionService;

	/**
	 * @Author Li9527
	 * @Description 设备状态展示
	 * @Date 2023-11-23 09:57:51
	 * @return com.xinsoft.common.Response<?>
	 **/
	@GetMapping("/deviceStatusData")
	public Response<?> deviceStatusData() {
		Map<String, Integer> dataMap = deviceService.deviceStatusData();
		return Response.succeed(dataMap);
	}

	/**
	 * @Description 在制订单数
	 **/
	@GetMapping("/count/inProcessOrders")
	public Response<?> inProcessOrders() {
		return Response.succeed(mesProducePlanService.getInProcessCount());
	}

	/**
	 * @Description 设备总数
	 **/
	@GetMapping("/count/deviceCount")
	public Response<?> deviceCount() {
		return Response.succeed(deviceService.deviceCount());
	}

	/**
	 * @Description 采购在途
	 **/
	@GetMapping("/count/inPurchase")
	public Response<?> inPurchase() {
		return Response.succeed(scmPurchasePlanService.inPurchase());
	}

	/**
	 * @Description 质量异常
	 **/
	@GetMapping("/count/inspection")
	public Response<?> inspection() {
		return Response.succeed(quaMaterialInspectionService.inspection());
	}
}
